<meta charset="UTF-8">
<style>
	.activeLi {
		background-color: rgba(228, 225, 225, 0.59) !important;
	}
	
	.nav>li>a:hover,
	.nav>li>a:active,
	.nav>li>a:focus {
		color: none;
		background: none;
	}
	
	.btn-box-tool {
		font-size: 14px;
	}
	
	.btn {
		margin: 0px;
	}
</style>
<div class="content-wrapper">
	<!-- Content Header (Page header) -->
	<section class="content-header">
		<h1 style="text-align:center">
      		车间与工序管理
        </h1>
	</section>

	<!-- Main content -->
	<section class="content">
		<div class="row">
			<div class="col-md-6" style="padding-right: 0px;">
				<div class="box form-horizontal" style="border-top: 0px; box-shadow: none">
					<div class="box-header">
						<h3 class="box-title">车间管理</h3>
						<button type="button" class="btn pull-right btn-primary" title="新增" ng-click="newWorkshop()"><i class="fa fa-plus"></i></button>
					</div>
					<div class="box-body" style="height: 500px;overflow-y: auto;">
						<table class="table table-condensed">
							<tbody>
								<tr>
									<th>序号</th>
									<th>车间名称</th>
									<th>车间主管</th>
									<th></th>
								</tr>
								<tr ng-repeat="w in workshops track by $index | orderBy : 'createTime'">
									<td>{{$index+1}}</td>
									<td>{{w.name}}</td>
									<td>{{w.leader_name}}</td>
									<td>
										
										<button type="button" style="padding-top: 0px;" class="btn btn-box-tool pull-right edit" title="修改" ng-click="editWorkshop(w)"><i class="fa fa-edit"></i></button>
										<button type="button" style="padding-top: 0px;" class="btn btn-box-tool pull-right del" title="删除" ng-click="delWorkshop(w)"><i class="fa fa-remove"></i></button>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			<div class="col-md-6" style="padding-left: 0px;">
				<div class="box form-horizontal" style="border-top: 0px; box-shadow: none">
					<div class="box-header">
						<h3 class="box-title">工序管理</h3>
						<button type="button" class="btn pull-right btn-primary" title="新增" ng-click="newProcedure()"><i class="fa fa-plus"></i></button>
					</div>
					<div class="box-body" style="height: 500px;overflow-y: auto;">
						<table class="table table-condensed">
							<tbody>
								<tr>
									<th>序号</th>
									<th>工序名称</th>
									<th>时间</th>
									<th></th>
								</tr>
								<tr ng-repeat="p in procedures track by $index | orderBy : 'createTime'">
									<td>{{$index+1}}</td>
									<td>{{p.name}}</td>
									<th>{{p.intervalTime}}</th>
									<td>
										<button type="button" style="padding-top: 0px;" class="btn btn-box-tool pull-right edit" title="修改" ng-click="editProcedure(p)"><i class="fa fa-edit"></i></button>
										<button type="button" style="padding-top: 0px;" class="btn btn-box-tool pull-right del" title="删除" ng-click="delProcedure(p)"><i class="fa fa-remove"></i></button>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<!-- /.row -->
	</section>
	<!-- /.content -->
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-06-23
	描述：新增车间&修改车间
-->
<div class="modal fade" id="putWorkshop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content form-horizontal">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">{{method}}</h4>
			</div>
			<div class="modal-body box-body">
				<div class="form-group">
					<label class="col-sm-3 control-label">名称</label>
					<div class="col-sm-9">
						<input type="text" class="form-control" placeholder="名称" ng-required="true" ng-model="postWorkshopData.name">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">主管</label>
					<div class="col-sm-9">
						<select class="form-control " tabindex="-1" aria-hidden="true"  ng-model="postWorkshopData.leader_id" ng-options ="l.id as l.name for l in leaders"> <!--ng-options ="l.id as l.name for l in leaders"-->
							<option value="" selected hidden>
								<!--<option ng-repeat="l in leaders" value="{{l.id}}">{{l.name}}</option>-->
						</select>
					</div>
				</div>
				<div class="form-group">
                    <label for="inputEmail3" class="col-sm-4 control-label">
                    	是否支持加工时长定制
                    	<!--{{postWorkshopData.is_custom_board_worktime}}-->
                    </label>
                    <div class="col-sm-8">
                        <input class='tgl tgl-flat' id='internal_user' type='checkbox' ng-model="postWorkshopData.is_custom_board_worktime" >
						<label class='tgl-btn' for='internal_user'></label>
                    </div>
                </div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default pull-left btn-lg" data-dismiss="modal">取消</button>
				<button type="button" class="btn btn-success btn-lg" ng-click="saveWorkshop()">保存</button>
			</div>
		</div>
	</div>
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-06-27
	描述：删除车间&工序
-->
<div class="modal fade" id="delData" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content form-horizontal">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">提示</h4>
			</div>
			<div class="modal-body box-body">
				确定要删除{{delName}}吗？
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default pull-left btn-lg" data-dismiss="modal">取消</button>
				<button type="button" class="btn btn-success btn-lg" ng-click="sureDel()">确定</button>
			</div>
		</div>
	</div>
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-06-27
	描述：新建工序&修改工序
-->
<div class="modal fade" id="putProcedure" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content form-horizontal">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">{{method}}</h4>
			</div>
			<div class="modal-body box-body">
				<div class="form-group">
					<label class="col-sm-3 control-label">名称</label>
					<div class="col-sm-9">
						<input type="text" class="form-control" placeholder="名称" ng-required="true" ng-model="postProcedureData.name">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">间隔时间</label>
					<div class="col-sm-5">
						<input type="text" class="form-control" placeholder="间隔时间" ng-required="true" ng-model="postProcedureData.intervalTime" text-transform>
					</div>
					<label class="col-sm-4 control-label" style="text-align: left;">分钟(请输入整数)</label>
					<label class="col-sm-9 col-sm-offset-3 control-label" style="text-align: left;color: red;" ng-if="!isIntegerFlag">
						<i class="fa fa-remove" ></i>输入不为整数,请重新输入！
					</label>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default pull-left btn-lg" data-dismiss="modal">取消</button>
				<button type="button" class="btn btn-success btn-lg" ng-click="saveProcedure()">保存</button>
			</div>
		</div>
	</div>
</div>
